package com.powroznik.tracker.engine.services;

public class PortalServiceProxy implements com.powroznik.tracker.engine.services.PortalService {
  private String _endpoint = null;
  private com.powroznik.tracker.engine.services.PortalService portalService = null;
  
  public PortalServiceProxy() {
    _initPortalServiceProxy();
  }
  
  public PortalServiceProxy(String endpoint) {
    _endpoint = endpoint;
    _initPortalServiceProxy();
  }
  
  private void _initPortalServiceProxy() {
    try {
      portalService = (new com.powroznik.tracker.engine.services.PortalServiceServiceLocator()).getPortalServicePort();
      if (portalService != null) {
        if (_endpoint != null)
          ((javax.xml.rpc.Stub)portalService)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
        else
          _endpoint = (String)((javax.xml.rpc.Stub)portalService)._getProperty("javax.xml.rpc.service.endpoint.address");
      }
      
    }
    catch (javax.xml.rpc.ServiceException serviceException) {}
  }
  
  public String getEndpoint() {
    return _endpoint;
  }
  
  public void setEndpoint(String endpoint) {
    _endpoint = endpoint;
    if (portalService != null)
      ((javax.xml.rpc.Stub)portalService)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
    
  }
  
  public com.powroznik.tracker.engine.services.PortalService getPortalService() {
    if (portalService == null)
      _initPortalServiceProxy();
    return portalService;
  }
  
  public void registerNewAccount(com.powroznik.tracker.engine.services.User user, com.powroznik.tracker.engine.services.Account account) throws java.rmi.RemoteException{
    if (portalService == null)
      _initPortalServiceProxy();
    portalService.registerNewAccount(user, account);
  }
  
  public com.powroznik.tracker.engine.services.User getUserByKey(java.lang.String key) throws java.rmi.RemoteException{
    if (portalService == null)
      _initPortalServiceProxy();
    return portalService.getUserByKey(key);
  }
  
  public java.lang.String ping(java.lang.String message) throws java.rmi.RemoteException{
    if (portalService == null)
      _initPortalServiceProxy();
    return portalService.ping(message);
  }
  
  public com.powroznik.tracker.engine.services.Device getDeviceByCode1(java.lang.String code1) throws java.rmi.RemoteException{
    if (portalService == null)
      _initPortalServiceProxy();
    return portalService.getDeviceByCode1(code1);
  }
  
  public com.powroznik.tracker.engine.services.Account getAccountByUser(com.powroznik.tracker.engine.services.User user) throws java.rmi.RemoteException{
    if (portalService == null)
      _initPortalServiceProxy();
    return portalService.getAccountByUser(user);
  }
  
  public com.powroznik.tracker.engine.services.Location getLastKnownLocation(com.powroznik.tracker.engine.services.Device device) throws java.rmi.RemoteException{
    if (portalService == null)
      _initPortalServiceProxy();
    return portalService.getLastKnownLocation(device);
  }
  
  public void connectDevice(com.powroznik.tracker.engine.services.Account account, com.powroznik.tracker.engine.services.Device device, java.lang.String description) throws java.rmi.RemoteException{
    if (portalService == null)
      _initPortalServiceProxy();
    portalService.connectDevice(account, device, description);
  }
  
  public com.powroznik.tracker.engine.services.Location[] getLastKnownLocations(com.powroznik.tracker.engine.services.Device device) throws java.rmi.RemoteException{
    if (portalService == null)
      _initPortalServiceProxy();
    return portalService.getLastKnownLocations(device);
  }
  
  public void updateAccount(com.powroznik.tracker.engine.services.User user, com.powroznik.tracker.engine.services.Account account) throws java.rmi.RemoteException{
    if (portalService == null)
      _initPortalServiceProxy();
    portalService.updateAccount(user, account);
  }
  
  public com.powroznik.tracker.engine.services.Device[] getDevicesByAccount(com.powroznik.tracker.engine.services.Account account) throws java.rmi.RemoteException{
    if (portalService == null)
      _initPortalServiceProxy();
    return portalService.getDevicesByAccount(account);
  }
  
  public com.powroznik.tracker.engine.services.Device[] getAllDevices() throws java.rmi.RemoteException{
    if (portalService == null)
      _initPortalServiceProxy();
    return portalService.getAllDevices();
  }
  
  
}